package com.woniuxy.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.woniuxy.entity.FinaAccount;
import com.woniuxy.service.FinaAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 银行账户管理Controller
 */
@RestController
@RequestMapping("/finaAccount")
public class FinaAccountController extends BaseController {

    @Autowired
    private FinaAccountService finaAccountService;


    /**
     * 初始化银行账户管理页面
     *
     * @return
     */
    @GetMapping("/initFinaAccountPage")
    public TableDataInfo initPage() {
        startPage();
        List<FinaAccount> all = finaAccountService.initPage();
        return getDataTable(all);
    }


    /**
     * 添加银行账户
     *
     * @return
     */
    @PostMapping("/addBankAccount")
    public AjaxResult addBankAccount(@RequestBody FinaAccount finaAccount) {

        return finaAccountService.addBankAccount(finaAccount);
    }

    /**
     * 修改银行账户
     *
     * @return
     */
    @PutMapping("/updateBankAccount")
    public AjaxResult updateBankAccount(@RequestBody FinaAccount finaAccount) {

        return finaAccountService.updateBankAccount(finaAccount);
    }

    /**
     * 查询所有账户信息
     *
     * @param finaFow
     * @return
     */
    @GetMapping("/listAccounts")
    public AjaxResult listAccounts() {

        return finaAccountService.listAccounts();
    }
}
